-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(feedback): move userreport ingest and endpoints to feedback module #95392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -32,6 +35,9 @@ def save_feedback_event(event_data: Mapping[str, Any], project_id: int): | |||
|
|||
try: | |||
# Shim to UserReport | |||
# TODO: this logic should be extracted to a shim_to_userreport function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing in the next follow up
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Re: cursor - yes this is a metrics change I intentionally bundled in. We don't have a dashboard widget or monitor on this metric so going to rename it to match the other metrics in the file |
todo in follow-up: make a way to share |
Discovered in #95392 the monkeypatching of `OpenAI` class in `test_create_feedback.py` can affect `test_openai.py`, I'm guessing when they are ran in parallel. I haven't seen this flake anywhere else, but don't believe it's related to the changes in #95392. Using the patch context manager should fix this. "not spam" return value bleeds over to the openai test: <img width="806" height="476" alt="Screenshot 2025-07-15 at 10 51 22 AM" src="https://github.com/user-attachments/assets/d900d7d1-9138-422f-b354-ac94fad9967a" /> Ref [REPLAY-513: [PR Tracker] refactor backend user feedback code](https://linear.app/getsentry/issue/REPLAY-513/pr-tracker-refactor-backend-user-feedback-code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Feedback Saving Fails on Missing Environment
The save_event_feedback
function attempts to fetch the Environment
row using Environment.objects.get(...)
. If the referenced environment (or default "production") does not exist for the project (environments are lazily created), Environment.objects.get()
raises Environment.DoesNotExist
. This unhandled exception crashes the save_event_feedback
task, leading to lost feedback. This is a regression from the previous implementation, which used get_or_create
or similar logic to handle missing environments gracefully.
src/sentry/feedback/usecases/ingest/save_event_feedback.py#L43-L50
sentry/src/sentry/feedback/usecases/ingest/save_event_feedback.py
Lines 43 to 50 in 0d7be65
if associated_event_id: | |
project = Project.objects.get_from_cache(id=project_id) | |
environment = Environment.objects.get( | |
organization_id=project.organization_id, | |
name=fixed_event_data.get("environment", "production"), | |
) | |
timestamp = fixed_event_data["timestamp"] |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Re: @cursoragent the exception is caught at the bottom of the fx |
User reports are the same product as feedback and owned by replay team. I'd like to move the code here for organizational purposes. Same goes for the feedback summary endpoint. This PR only moves things around, no implementation changes.
Ref REPLAY-513: [PR Tracker] refactor backend user feedback code
I plan to follow up with quality improvements to the ingest functions, making them more composable, so that module's subject to change.